#!/bin/bash
if [ $# != 3 ] ; then
echo -e "USAGE: $0 path_to_file target_func max_tests\n"
exit 1;
fi
cp /home/howl/klee/bu/bin/klee .
# clang -emit-llvm -c -g -O0 -Xclang -disable-O0-optnone $1.c
echo "clang -emit-llvm -c $1.c"
clang -emit-llvm -c $1.c
clang -emit-llvm -S $1.c
# ./klee --search=CovTarget --count-coverage-ratio --target-function=$2 --posix-runtime --libc=uclibc $1.bc
# ./klee --search=CovTarget --count-coverage-ratio --target-function=$2 --posix-runtime $1.bc
echo "./klee --search=CovTarget --count-coverage-ratio --target-function=$2 --max-tests=$3 $1.bc"
./klee --search=CovTarget --target-function=$2 --rapid-loop-search --max-tests=$3 $1.bc

# echo "./klee --count-coverage-ratio  --target-function=$2 --max-tests=$3 $1.bc"
# ./klee --count-coverage-ratio  --target-function=$2 --max-tests=$3 $1.bc

# echo "./klee --search=dfs --count-coverage-ratio --target-function=$2 --max-tests=$3 $1.bc"
# ./klee --search=dfs --count-coverage-ratio --target-function=$2 --max-tests=$3 $1.bc

# echo "./klee --search=bfs --count-coverage-ratio --target-function=$2 --max-tests=$3 $1.bc"
# ./klee --search=bfs --count-coverage-ratio --target-function=$2 --max-tests=$3 $1.bc

echo "dot -T pdf a_0.dot -o a_0.pdf"
dot -T pdf a_0.dot -o a_0.pdf

echo "dot -T pdf constraintTree.dot -o cons.pdf"
dot -T pdf constraintTree.dot -o cons.pdf